<div th:fragment="user_manage">
    <div id="userModal" style="" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true" data-keyboard="false">
        <div class="modal-dialog modal-md" style="width:1000px;" id="modal-dialog">
            <div class="modal-content" id="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">&times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel" v-if="islistshow">管理人员列表</h4>
                    <h4 class="modal-title"  v-if="isuseraddshow">新增管理人员</h4>
                    <h4 class="modal-title"  v-if="isusereditshow">修改管理人员</h4>
                </div>
                <div class="modal-body" style="overflow: auto;" id="myModalBody">
                    <!--人员列表-->
                    <div class="col-sm-12 table-striped" v-if="islistshow">
                        <div shiro:hasAnyRoles="zhongxin_superadmin,dept_superadmin" id="toolbar" role="group" class="btn-group-md" style="height: 50px; line-height: 50px;"><a
                                 @click="userAdd" class="btn btn-primary btn-rounded btn-md"><i class="fa fa-plus"></i> 新增
                        </a></div>
                        <table class="table table-hover table-primary table-striped">
                            <thead>
                            <tr>
                                <th style="text-align: center; vertical-align: middle;">用户名称</th>
                                <th style="text-align: center; vertical-align: middle;">角色名称</th>
                                <th style="text-align: center; vertical-align: middle;">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="(user,index) in userlist" v-if="userlist.length > 0">
                                <td style="vertical-align: middle; text-align: center;" v-text="user.user_name"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="user.role_name"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="">
                                    <button shiro:hasAnyRoles="zhongxin_superadmin,dept_superadmin" class="btn btn-warning btn-rounded btn-md"
                                            @click="userModify(user)">修改
                                    </button>
                                    <button shiro:hasAnyRoles="zhongxin_superadmin,dept_superadmin" v-if="roleid==danweichaoguanroleid||roleid==zjzxroleid" class="btn btn-warning btn-rounded btn-md"
                                            @click="resetPwd(user)">修改密码
                                    </button>
                                    <button shiro:hasAnyRoles="zhongxin_superadmin,dept_superadmin" v-if="user.role_id!=100" class="btn btn-danger btn-rounded btn-md"
                                            @click="userRemove(user.user_id)">删除
                                    </button>
                                </td>
                            </tr>
                            <tr v-if="deptlist.length == 0">
                                <td style="text-align: center; vertical-align: middle" colspan="3">查无数据</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                    <!--新增-->
                    <div class="wrapper wrapper-content animated fadeInRight" v-if="isuseraddshow">
                        <form class="form-horizontal m" id="form-user-add">
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-required">用户名称：</label>
                                <div class="col-sm-8">
                                    <input name="userName" placeholder="请输入用户名称" class="form-control" type="text"
                                           maxlength="30" required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">角色：</label>
                                <div class="col-sm-8">
                                    <select id="role" name="role" class="form-control m-b">
                                        <option value="100" selected="selected">超级管理员</option>
                                        <!--<option value="105" >单位普通管理员</option>-->
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-required">登录账号：</label>
                                <div class="col-sm-8">
                                    <input id="loginName" name="loginName" placeholder="请输入登录账号" class="form-control"
                                           type="text" maxlength="30" required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-required">登录密码：</label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <input id="password" name="password" placeholder="请输入登录密码" class="form-control"
                                               type="password" th:value="${@config.getKey('sys.user.initPassword')}"
                                               required>
                                        <span class="input-group-addon" title="登录密码,鼠标按下显示密码"
                                              onmousedown="$('#password').attr('type','text')"
                                              onmouseup="$('#password').attr('type','password')"><i
                                                class="fa fa-key"></i></span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所属部门：</label>
                                <div class="col-sm-8">
                                        <input id="text1" name="text1" placeholder="请输入所属部门"
                                               class="form-control" type="text" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">办公电话：</label>
                                <div class="col-sm-8">
                                        <input id="text2" name="text2" placeholder="请输入办公电话"
                                               class="form-control" type="text" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">手机：</label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <input id="phonenumber" name="phonenumber" placeholder="请输入手机号码"
                                               class="form-control" type="text" >
                                        <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">邮箱：</label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <input id="email" name="email" class="form-control email" type="text"
                                               maxlength="50" placeholder="请输入邮箱">
                                        <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注：</label>
                                <div class="col-sm-8">
                                            <textarea name="remark" maxlength="500" class="form-control"
                                                      rows="3"></textarea>
                                </div>
                            </div>
                        </form>
                    </div>

                    <!--修改-->
                    <div class="wrapper wrapper-content animated fadeInRight" v-if="isusereditshow">
                        <form class="form-horizontal m" id="form-user-edit">
                            <input id="userId" name="userId" type="hidden" :value="user.user_id"/>
                            <input id="deptId" name="deptId" type="hidden" :value="user.dept_id"/>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-required">用户名称：</label>
                                <div class="col-sm-8">
                                    <input name="userName" placeholder="请输入用户名称" class="form-control" type="text"
                                           :value="user.user_name" maxlength="30" required>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">角色：</label>
                                <div class="col-sm-8">

                                    <input disabled class="form-control" type="text"  :value="user.role_name" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label is-required">登录账号：</label>
                                <div class="col-sm-8">
                                    <input id="loginName" name="loginName" placeholder="请输入登录账号"
                                           class="form-control is-required" :value="user.login_name"
                                           type="text" maxlength="30" required readonly>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所属部门：</label>
                                <div class="col-sm-8">
                                    <input id="text1" name="text1" placeholder="请输入所属部门" :value="user.text1"
                                           class="form-control" type="text" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">办公电话：</label>
                                <div class="col-sm-8">
                                    <input id="text2" name="text2" placeholder="请输入办公电话" :value="user.text2"
                                           class="form-control" type="text" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">手机：</label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <input id="phonenumber" name="phonenumber" placeholder="请输入手机号码"
                                               :value="user.phonenumber"
                                               class="form-control" type="text" maxlength="11">
                                        <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">邮箱：</label>
                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <input id="email" name="email" class="form-control email" type="text"
                                               :value="user.email"
                                               maxlength="50" placeholder="请输入邮箱">
                                        <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注：</label>
                                <div class="col-sm-8">
                                            <textarea name="remark" maxlength="500" class="form-control"
                                                      rows="3">{{user.remark}}</textarea>
                                </div>
                            </div>
                        </form>
                    </div>


                </div>
                <div class="modal-footer" v-if="islistshow">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
                <div class="modal-footer" v-if="isuseraddshow">
                    <button type="button" class="btn btn-sm btn-primary" @click="submitHandler()"><i
                            class="fa fa-check"></i>保 存
                    </button>&nbsp;
                    <button type="button" class="btn btn-sm btn-danger" @click="closeUserAdd()"><i
                            class="fa fa-reply-all"></i>返 回
                    </button>
                </div>
                <div class="modal-footer" v-if="isusereditshow">
                    <button type="button" class="btn btn-sm btn-primary" @click="submitUserEdit()"><i
                            class="fa fa-check"></i>保 存
                    </button>&nbsp;
                    <button type="button" class="btn btn-sm btn-danger" @click="closeUserEdit()"><i
                            class="fa fa-reply-all"></i>返 回
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
